<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>iterable</title>

    <script>

        'use strict';
        let a = ['A', 'B', 'C'];
        let s = new Set(['A', 'B', 'C']);
        let m = new Map([[1, 'x'], [2, 'y'], [3, 'z']]);
        for (let x of a) { // 遍历Array
            console.log(x);
        }
        for (let x of s) { // 遍历Set
            console.log(x);
        }
        for (let x of m) { // 遍历Map
            console.log(x[0] + '=' + x[1]);
            // console.log(x);
        }


        // element: 指向当前元素的值
        // index: 指向当前索引
        // array: 指向Array对象本身
        a.forEach(function (element, index, array) {
            console.log(element + ', index = ' + index);
            console.log(array);
        });

        s.forEach(function (element, sameElement, set) {
            console.log(element);
        });

        m.forEach(function (value, key, map) {
            console.log(value);
        });

    </script>

</head>
<body>



</body>
</html>